home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / fax / src / util / Types.h < prev    next >
C/C++ Source or Header  |  1994-08-01  |  4KB  |  112 lines

  1. /*    $Header: /usr/people/sam/fax/util/RCS/Types.h,v 1.14 1994/02/28 14:24:03 sam Rel $ */
  2. /*
  3.  * Copyright (c) 1990, 1991, 1992, 1993, 1994 Sam Leffler
  4.  * Copyright (c) 1991, 1992, 1993, 1994 Silicon Graphics, Inc.
  5.  *
  6.  * Permission to use, copy, modify, distribute, and sell this software and 
  7.  * its documentation for any purpose is hereby granted without fee, provided
  8.  * that (i) the above copyright notices and this permission notice appear in
  9.  * all copies of the software and related documentation, and (ii) the names of
  10.  * Sam Leffler and Silicon Graphics may not be used in any advertising or
  11.  * publicity relating to the software without the specific, prior written
  12.  * permission of Sam Leffler and Silicon Graphics.
  13.  * 
  14.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  15.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  16.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  17.  * 
  18.  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
  19.  * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
  20.  * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  21.  * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF 
  22.  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
  23.  * OF THIS SOFTWARE.
  24.  */
  25. #ifndef _Types_
  26. #define    _Types_
  27.  
  28. #include "string.h"
  29. #include "assert.h"
  30. #include "stdio.h"
  31. #include "new.h"
  32. #include "sys/types.h"
  33. #include "port.h"
  34.  
  35. // Boolean type
  36. typedef unsigned char fxBool;
  37. #undef    TRUE
  38. #define    TRUE    ((fxBool)1)
  39. #undef    FALSE
  40. #define    FALSE    ((fxBool)0)
  41.  
  42. // minimum of two numbers
  43. inline int fxmin(int a, int b)        { return (a < b) ? a : b; }
  44. inline u_long fxmin(u_long a, u_long b)    { return (a < b) ? a : b; }
  45. inline u_int fxmin(u_int a, u_int b)    { return (a < b) ? a : b; }
  46.  
  47. // maximum of two numbers
  48. inline int fxmax(int a, int b)        { return (a > b) ? a : b; }
  49. inline u_long fxmax(u_long a, u_long b)    { return (a > b) ? a : b; }
  50. inline u_int fxmax(u_int a, u_int b)    { return (a > b) ? a : b; }
  51.  
  52. #ifdef NDEBUG
  53. #define fxAssert(EX,MSG)
  54. #else
  55. extern "C" void _fxassert(const char*, const char*, int);
  56. #define fxAssert(EX,MSG) if (EX); else _fxassert(MSG,__FILE__,__LINE__);
  57. #endif
  58.  
  59. //----------------------------------------------------------------------
  60.  
  61. // Use this macro at the end of a multi-line macro definition.  This
  62. // helps eliminate the extra back slash problem.
  63. #define __enddef__
  64.  
  65. // Some macros for namespace hacking.  These macros concatenate their
  66. // arguments.
  67. #ifdef    __ANSI_CPP__
  68. #define fxIDENT(a) a
  69. #define fxCAT(a,b) a##b
  70. #define fxCAT2(a,b) a##b
  71. #define fxCAT3(a,b,c) a##b##c
  72. #define fxCAT4(a,b,c,d) a##b##c##d
  73. #define fxCAT5(a,b,c,d,e) a##b##c##d##e
  74.  
  75. #define    fxQUOTE(a) #a
  76. #else
  77. #define fxIDENT(a) a
  78. #define fxCAT(a,b) fxIDENT(a)b
  79. #define fxCAT2(a,b) fxIDENT(a)b
  80. #define fxCAT3(a,b,c) fxCAT2(a,b)c
  81. #define fxCAT4(a,b,c,d) fxCAT3(a,b,c)d
  82. #define fxCAT5(a,b,c,d,e) fxCAT4(a,b,c,d)e
  83.  
  84. #define    fxQUOTE(a) "a"
  85. #endif
  86.  
  87. //----------------------------------------------------------------------
  88.  
  89. // Workaround for g++ new(where) incompatibility (yech)
  90.  
  91. #if defined(__GNUC__) && !defined(NEW_FIXED)
  92. #define    fxNEW(where)    new{where}
  93. #else
  94. #define    fxNEW(where)    new(where)
  95. #endif
  96.  
  97. //----------------------------------------------------------------------
  98.  
  99. // Workaround for difficulties with signal handler definitions (yech)
  100.  
  101. #ifndef fxSIGHANDLER
  102. #define    fxSIGHANDLER
  103. #endif
  104. #ifndef fxSIGVECHANDLER
  105. #define    fxSIGVECHANDLER
  106. #endif
  107. #ifndef fxSIGACTIONHANDLER
  108. #define    fxSIGACTIONHANDLER
  109. #endif
  110.  
  111. #endif /* _Types_ */
  112.